<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

</body>
<script>
  class Preson {
    hai = "靓仔"; //不是私有的属性可以被继承
    #say = "大家好....";
    constructor(name, age) {
      this.name = name;
      this.age = age;
    }
    #show() {
      console.log(this.#say);
    }
    da() {
      console.log(`我不是私有方法`);
      this.#show()
      console.log(`this.#say`, this.#say);
    }
  };

  class Son extends Preson {
    constructor(...arg) {
      super(arg[0], arg[1]);
      this.dd = arg[2];
    }
    sayhai() {
      console.log(`私有属性和私有方法`);
    }
  }

  const son = new Son();
  son.da();
  console.log(son.hai); //不是私有属性可以被继承
</script>

</html>